[xh]COMPLEMENTARY PIC TRICK

Dear EPE,

This PIC Trick turns out to be a gem for its sheer simplicity.
Quite a few processors have a Complement Carry instruction, but not the PIC.
Although it is not a heavily used instruction it does have its uses.
 
; Complement Carry
; STATUS bits affected: C = NOT C, DC = old C
BCF STATUS,DC
INCFSZ STATUS,F
NOP
 
The first instruction clears the DC bit to eensure no other STATUS bits are
changed.The second instruction has the effect of complementing bit 0 (carry
bit) and shifting bit 0 into bit 1 (DC). The INCFSZ instruction, not INCF,
must be used as it does not affect any other STATUS bits. The NOP cancels
the effect of skip if zero.
 
Peter Hemsley, via email
 
How superbly simple - now I must try to find a use for it, as I have done
with so many of your offerings! Readers, if you have not yet discovered
our PIC Tricks folder on our ftp site, do so. There are many useful PIC
routines there, many of them by Peter and which are extremely useful, as well
as being neat and compact.
